#[test]
fn array() {
    let array = std::array::from_fn(|i| i);
    // indexes are:    0  1  2  3  4
    assert_eq!(array, [0, 1, 2, 3, 4]);

    let array2: [usize; 8] = std::array::from_fn(|i| i * 2);
    // indexes are:     0  1  2  3  4  5   6   7
    assert_eq!(array2, [0, 2, 4, 6, 8, 10, 12, 14]);

    let bool_arr = std::array::from_fn::<_, 5, _>(|i| i % 2 == 0);
    // indexes are:       0     1      2     3      4
    assert_eq!(bool_arr, [true, false, true, false, true]);
}
